package com.flower.controller.buyer;
import com.flower.domain.entity.Category;
import com.flower.service.CategoryService;
import com.flower.utils.AjaxResult;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 购买者端商品分类
 */
@RestController("buyer")
@RequestMapping("/buyer/category")
@RequiredArgsConstructor
public class CategoryController {
    private final CategoryService categoryService;

    /**
     * 获取商品分类列表
     * @return
     */
    @GetMapping("/list")
    public AjaxResult getCategoryList() {
        // 排除getCategoryId为0的分类
        List<Category> categoryList = categoryService.lambdaQuery()
                .ne(Category::getCategoryId, 0)
                .list();
        return AjaxResult.success(categoryList);
    }

}
